//request只是更换了一个名字
import request from '/@/utils/request';

/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 登录api接口集合
 * @method WhPagePost 分页查询仓库
 * @method signOut 用户退出登录
 */
export function WmsApi() {

	return {

		//仓库接口
		WhPagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGWareHouse/getWareHouseDataAll`,
				method: 'post',
				data//这个没写
			});
		},
		WhPageAdd: (data: object) => {
			return request({
				url: `/api/eGWareHouse/add`,
				method: 'post',
				data,
			});
		},
		WhPageDelete: (id: string) => {
			return request({
				url: `/api/eGWareHouse/delete/${id}`
					.replace(`{${"page"}}`, encodeURIComponent(String(id))),
				method: 'post'
			});
		},

		WhPagePut: (data: object) => {
			return request({
				url: `/api/eGWareHouse/update`,
				method: 'post',
				data,
			});
		},
		WhPageList: (data: object) => {
			return request({
				url: '/api/eGWareHouse/list',
				method: 'get',
				data,
			});
		},
		//每月出入库数量统计
		Putin: () => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/base/monthlyInventoryQuantity`,
				method: 'get',
			});
		},

		Out: () => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/base/monthlyOutboundQuantity`,
				method: 'get',
			});
		},
		//安全库存接口
		SafeStorage: (page: integer, pagesize: integer) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/materialSafetyInventory/${page}/${pagesize}`
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'get'
			});
		},
		TimeControl: (page: integer, pagesize: integer) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/earlyWarningTimeOfMaterielStorage/${page}/${pagesize}`
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'get'
			});
		},
		outTimeControl: (page: string, pagesize: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/materialInStockTimeControlExceed/${page}/${pagesize}`
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'get'
			});
		},
		//修改安全库存
		PutSafeStorage: (materielnum: string, SafetyCount: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/updateSafetyCount/${materielnum}/${SafetyCount}`
					.replace(`{${"materielnum"}}`, encodeURIComponent(String(materielnum)))
					.replace(`{${"SafetyCount"}}`, encodeURIComponent(String(SafetyCount))),
				method: 'post',
			});
		},
		PutTimeControl: (materielnum: string, hour: Number) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/updateWarningMaterialTimeInStorage/${materielnum}/${hour}`
					.replace(`{${"materielnum"}}`, encodeURIComponent(String(materielnum)))
					.replace(`{${"hour"}}`, encodeURIComponent(String(hour))),
				method: 'post',
			});
		},

		//区域定义
		RegionPagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/selectRegionStorageCount`,
				method: 'post',
				data
			});
		},
		RegionPageAdd: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/add`,
				method: 'post',
				data,
			});
		},
		RegionPageDelete: (id: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/delete/${id}`
					.replace(`{${"page"}}`, encodeURIComponent(String(id))),
				method: 'post',

			});
		},
		RegionPagePut: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/update`,
				method: 'post',
				data,
			});
		},
		RegionStoragePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/reasonRegionSelectStorage`,
					
				method: 'post',
				data
			});
		},
		//当前区域下的库位内容
		RegionAllStoragePost: (regionnum: string, page: string, pagesize: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/allLocationsUnderStorage/${regionnum}/${page}/${pagesize}`
					.replace(`{${"page"}}`, encodeURIComponent(String(regionnum)))
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'post',
			});
		},
		//可移动库位
		RegionAllCanMoveStoragePost: (page: string, pagesize: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/allUnoccupiedStorage/${page}/${pagesize}`
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'post',
			});
		},
		RegionNotStoragePost: (regionnum: string, page: string, pagesize: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRegion/reasonRegionSelectNotStorage/${regionnum}/${page}/${pagesize}`
					.replace(`{${"page"}}`, encodeURIComponent(String(regionnum)))
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'post',

			});
		},
		//库位定义
		eGStoragePagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGStorage/getStorageRegionAndWH`,
				method: 'post',
				data
			});
		},
		//根据库位类别查对应库位
		eGStoragePagePostByType: (type: string, page: string, pagesize: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGStorage/screeningRepositoryLocation/${type}/${page}/${pagesize}`
					.replace(`{${"type"}}`, encodeURIComponent(String(type)))
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'post'
			});
		},
		eGStoragePageAdd: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGStorage/add`,
				method: 'post',
				data,
			});
		},
		eGStoragePageDelete: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGStorage/delete`,
				method: 'post',
				data,
			});
		},
		eGStoragePagePut: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGStorage/update`,
				method: 'post',
				data,
			});
		},
		//库存查询
		InvtoryPagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/base/materialAccorDingSumCount`,
				method: 'post',
				data
			});
		},

		InvtoryDetailGet: (materielNum: string, page: integer, pagesize: integer) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/base/getMaterileNumAllInventoryRecords/${materielNum}/${page}/${pagesize}`
					.replace(`{${"materielNum"}}`, encodeURIComponent(String(materielNum)))
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'post',

				// data
			});
		},
		//入库出库记录接口
		PutAndOutPagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eG_WMS_InAndOutBound/page`,
				method: 'post',
				data,
			});
		},
		//得到出入口记录的详情表	
		PutAndOutdetail: (inandoutbound: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/base/getAllInAndBoundDetailMessage/${inandoutbound}`
					.replace(`{${"inandoutbound"}}`, encodeURIComponent(String(inandoutbound))),
				method: 'post'
			});
		},
		//移库接口
		MovePagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRelocation/getAllRelocationsAndStorageTime`,
				method: 'post',
				data
			});
		},
		MoveOperation: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGRelocation/moveTheEntireDenseLibrary`,
				method: 'post',
				data
			});
		},
		//物料接口
		MaterielPagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/getMaterielsDataAndNumNameSpecs`,
				method: 'post',
				data,
			});
		},
		//有库存的物料
		MaterielCheck: (data: object) => {
			return request({
				
				url: `${import.meta.env.VITE_API_URL0}/api/base/queryMaterialsAccordingInventory`,
				method: 'post',
				data
			});
		},
		MaterielPageAdd: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/add`,
				method: 'post',
				data,
			});
		},
		MaterielPageDelete: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/delete`,
				method: 'post',
				data,
			});
		},
		MaterielPagePut: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGMateriel/update`,
				method: 'post',
				data,
			});
		},
		//料箱接口
		WbPagePost: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGWorkBin/page`,
				method: 'post',
				data,
			});
		},
		WbPageAdd: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGWorkBin/add`,
				method: 'post',
				data,
			});
		},
		WbPageDelete: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGWorkBin/delete`,
				method: 'post',
				data,
			});
		},
		recallWorkbin: (workbinnum : string, page: integer, pagesize: integer) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGWorkBin/workBinBackTracKing/${workbinnum}/${page}/${pagesize}`.replace(`{${"materielNum"}}`, encodeURIComponent(String(workbinnum)))
					.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'post',
			
			});
		},
		WbPagePut: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGWorkBin/update`,
				method: 'post',
				data,
			});
		},
		//栈板接口
		PalletPagePost: (data: object) => {
			return request({
				url: '/api/eGPallet/page',
				method: 'post',
				data,
			});
		},
		PalletPageAdd: (data: object) => {
			return request({
				url: '/api/eGPallet/add',
				method: 'post',
				data,
			});
		},
		PalletPageDelete: (data: object) => {
			return request({
				url: '/api/eGPallet/delete',
				method: 'post',
				data,
			});
		},
		PalletPagePut: (data: object) => {
			return request({
				url: '/api/eGPallet/update',
				method: 'post',
				data,
			});
		},
		//agv任务模板&agv任务
		modelPagePost: (data: object) => {
			return request({
				url: `/AGV/Task/GetTemLogicsAll`,
				method: 'post',
				data
			});
		},
		// 新增WCS模板
		// AGV/WcsTask/AddWcsTaskModel
		addWcsModel: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/AGV/WcsTask/AddWcsTaskModel`,
				method: 'post',
				data
			});
		},
		//删除WCS模板
		delWcsModel: (id: String) => {
			return request({
				url: `/AGV/WcsTask/DelWcsTaskTemp?input=${id}`,
				method: 'post',
				
			});
		},
		//修改WCS模板
		ModifyWcsModel: (data: object) => {
			return request({
				
				url: `${import.meta.env.VITE_API_URL0}/AGV/WcsTask/ModifyWcsTaskTemp`,
				method: 'post',
				data
			});
		},
		//获取报警信息
		
		getAlarm: (data: object) => {
			return request({
				
				url: `/AGV/Alarm/GetAlarmlist`,
				method: 'post',
				data
			});
		},
		// 请求用户选择的容器规格的id，用于添加步骤的id	
		getTrueDictId: (data: object) => {
			return request({
				url: '/api/sysDictType/page',
				method: 'post',
				data,
			});
		},
		// /AGV/WcsTask/DelWcsTaskTemp
		modelPageAdd: (data: object) => {
			return request({
				url: '/AGV/Task/AddTemLogicModel',
				method: 'post',
				data
			});
		},
		modelPageDelete: (id: Number) => {
			return request({
				url: `/AGV/Task/DeleteTemLogic?input=${id}`,
				method: 'post',
			});
		},

		modelPagePut: (data: object) => {
			return request({
				url: '/AGV/Task/UpdateTemLogic',
				method: 'post',
				data,
			});
		},
		//agv任务
		agvPagePost: (data: object) => {
			return request({
				url: '/AGV/Task/PageAsync',
				method: 'post',
				data,
			});
		},
		agvPageAdd: (data: object) => {
			return request({
				url: '/AGV/Task/AddAsync',
				method: 'post',
				data,
			});
		},
		agvCancel: (data: object) => {
			return request({
				url: '/AGV/Task/CancelAsync',
				method: 'post',
				data,
			});
		},
		//查底下区域的库位数量接口
		StorageCount: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGStorage/sumStorageCount`,
				method: 'get',
				data
			});
		},
		//盘点任务
		TakeInventoryTask: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGTakeStock/page`,
				method: 'post',
				data
			});
		},
		//根据库位生成盘点任务
		CreateTaskByStorage: (storagenum: string, taskstockremake: string) => {
			return request({
				url: `/api/eGTakeStock/generateTakeStockTask/${storagenum}/${taskstockremake}`
					.replace(`{${"inandoutbound"}}`, encodeURIComponent(String(storagenum)))
					.replace(`{${"inandoutbound"}}`, encodeURIComponent(String(taskstockremake))),
				method: 'post',
			});
		},
		CreateTaskByMaterial: (data: object) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGTakeStock/generateInventoryTask`,
				method: 'post',
				data
			});
		},

		updateStorage: (data: object) => {
			return request({
				url: '/api/eGStorage/changeTheOwningAreaOfRepositoryInBatches',
				method: 'post',
				data
			});
		},

		fullStorage: (page: string, pagesize: string) => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/base/storageExistInventory/${page}/${pagesize}`.replace(`{${"page"}}`, encodeURIComponent(String(page)))
					.replace(`{${"pagesize"}}`, encodeURIComponent(String(pagesize))),
				method: 'post',

			});
		},
		//得到密集库占用
		getDenseOccupation: () => {
			return request({
				url: "/api/eGStorage/queryTheOccupancyOfStorageSpace",
				method: 'get',
			});
		},
		//得到具体库位内的内容 
		getStorageDetail: (storagenum: string) => {
			return request({
				url: `/api/eGStorage/queryStorageInventoryData/${storagenum}`
					.replace(`{${"storagenum"}}`, encodeURIComponent(String(storagenum))),
				method: 'post',
			});
		},
		rukuStrategy: (materielNum: string) => {
			return request({
				url: `/api/base/aGVStrategyReturnRecommEndStorage/${materielNum}`
					.replace(`{${"storagenum"}}`, encodeURIComponent(String(materielNum))),
				method: 'post',
			});
		},
		//异常任务
		InAndOutPagePostFail: (data: object) => {
			return request({
				url: '/api/eG_WMS_InAndOutBound/pageFail',
				method: 'post',
				data,
			});
		},
		//查看agv状态
		CheckAgvStatus: (data: object) => {
			return request({
				url: '/api/aGVStatus/getAGVInformationData',
				method: 'post',
				data,
			});
		},
		//每日入库数量
		getDayInINfo: () => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGInventory/dailyInBoundQuantity`,
				method: 'post',
			});
		},
		getDayOutINfo: () => {
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/eGInventory/dailyOutBoundQuantity`,
				method: 'post',
			});
		},
		//新增物料等级
		putNewClass:(data:object)=>{
			return request({
				url: "/api/materielLevel/add",
				method: 'post',
				data
			})
		},
		getAllClass:(data:object)=>{
			return request({
				url: `${import.meta.env.VITE_API_URL0}/api/materielLevel/page`,
				method: 'post',
				data
			})
		},
		modifyClass:(data:object)=>{
			return request({
				url: "api/materielLevel/updateMaterielLevel",
				method: 'post',
				data
			})
		},
		//添加字典
		
		addNewDict:(data:object)=>{
			return request({
				url: "/api/sysDictData/add",
				method: 'post',
				data
			})
		},
		
		getAllDict:(data:object)=>{
			return request({
				url: "/api/sysDictData/page",
				method: 'post',
				data
			})
		},
		modifyDict:(data:object)=>{
			return request({
				url: "/api/sysDictData/update",
				method: 'post',
				data
			})
		},
		
		delDictData:(data:object)=>{
			return request({
				url: "/api/sysDictData/delete",
				method: 'post',
				data
			})
		},
		//获取打印模板
		// /api/sysPrint/print/
		getPrintTemplate:(name:string)=>{
			return request({
				url: `/api/sysPrint/print/${name}`,
				method: 'get'
			
			})
		},
		//批量导入库位
		
		bulkImport:(data:object)=>{
			return request({
				url: "/api/eGStorage/batchAddStorage",
				method: 'post',
				data
			})
		},
	}
}
export function WcsApi(){
	return {
		
		checkModel:(data:object)=>{
			return request({
				url: `/AGV/WcsTask/GetWcsTaskTempPage`,
				method: 'post',
				data
			})
		},
		checkTask:(data:object)=>{
			return request({
				url: `/AGV/WcsTask/GetWcsTaskPage`,
				method: 'post',
				data
			})
		}
	}
}
